Skip to content

docs(logger): extract Logger code snippets in separate files #1230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 13, 2023

Conversation

niko-achilles
Copy link
Contributor

Description of your changes

The code snippets are extracted to their own separate files, placed under docs/snippets/logger .
And project documentation in docs/core/logger.md references the code snippets, which are extracted to their own separate files.

Code snippets of logger created, in path docs/snippets/logger:

  1. basicUsage.ts
  2. sam.ts
  3. middy.ts
  4. decorator.ts
  5. manual.ts
  6. eventMiddy.ts
  7. eventDecorator.ts
  8. appendKeys.ts
  9. clearStateMiddy.ts
  10. clearStateDecorator.ts
  11. extraData.ts
  12. logError.ts
  13. createChild.ts
  14. logSampling.ts
  15. bringYourOwnFormatterHandler.ts
  16. bringYourOwnFormatterClass.ts
  17. unitTesting.ts

Each code snippet is referenced as --8<-- "docs/snippets/logger/.ts" in docs/core/logger.md .

TODO items:

  1. Lint code snippets created in path docs/snippets/logger by using current eslint rules that are used for packages managed by monorepo as workspaces
  2. Correct code snippets by consulting the eslint findings.
  3. May Adjust the eslint configuration to documentation needs, e.g. allow any type or adjust the code snippets by removing event and context from the handler signature .
  4. introduce docs/snippets/logger as workspace in package.json managed by monorepo . This will enable to reuse the .tsconfig.es.json used by workspaces in monorepo or to identify the need to improve .tsconfig.es.json, e.g. introducing noEmit: true which signals to a dev. that the tsconfig.es.json file is used for linting/dev. purposes only. Also the tsconfig file used for linting should have the experimentalDecorators: true .

How to verify this change

Modified docs/core/logger.md
Added code snippets as .ts files in path docs/snippets/logger

Related issues, RFCs

Issue number: #1220 #729

PR status

Is this ready for review?: YES
Is it a breaking change?: NO

Checklist

  • My changes meet the tenets criteria
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding changes to the examples
  • My changes generate no new warnings
  • The code coverage hasn't decreased
  • I have added tests that prove my change is effective and works
  • New and existing unit tests pass locally and in Github Actions
  • Any dependent changes have been merged and published
  • The PR title follows the conventional commit semantics

Breaking change checklist

  • I have documented the migration process
  • I have added, implemented necessary warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@pull-request-size pull-request-size bot added the size/XL PRs between 500-999 LOC, often PRs that grown with feedback label Jan 12, 2023
@niko-achilles
Copy link
Contributor Author

@dreamorosi please review this commit and read the TODO items described in the comment. As we aligned in #1220 the TODO items are not part of this PR. Have documented the TODOS for continuation to our work in context of code snippets and docs.

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jan 12, 2023
@dreamorosi dreamorosi self-requested a review January 13, 2023 09:50
Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff, I have tested the docs locally and they work.

Acknowledge the items still left todo, we'll address them in a future PR.

@dreamorosi dreamorosi merged commit 7e6b4a9 into aws-powertools:main Jan 13, 2023
@dreamorosi dreamorosi linked an issue Jan 13, 2023 that may be closed by this pull request
1 task
@niko-achilles niko-achilles deleted the logger-code-snippets branch January 13, 2023 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation size/XL PRs between 500-999 LOC, often PRs that grown with feedback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs: extract Logger code snippets in separate files
2 participants